# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AdSense.V2.Model.Payment do
  @moduledoc """
  Representation of an unpaid or paid payment. See [Payment timelines for AdSense](https://support.google.com/adsense/answer/7164703) for more information about payments and the [YouTube homepage and payments account](https://support.google.com/adsense/answer/11622510) article for information about dedicated payments accounts for YouTube.

  ## Attributes

  *   `amount` (*type:* `String.t`, *default:* `nil`) - Output only. The amount of unpaid or paid earnings, as a formatted string, including the currency. E.g. "¥1,235 JPY", "$1,234.57", "£87.65".
  *   `date` (*type:* `GoogleApi.AdSense.V2.Model.Date.t`, *default:* `nil`) - Output only. For paid earnings, the date that the payment was credited. For unpaid earnings, this field is empty. Payment dates are always returned in the billing timezone (America/Los_Angeles).
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. Resource name of the payment. Format: - accounts/{account}/payments/unpaid for unpaid (current) AdSense earnings. - accounts/{account}/payments/youtube-unpaid for unpaid (current) YouTube earnings. - accounts/{account}/payments/yyyy-MM-dd for paid AdSense earnings. - accounts/{account}/payments/youtube-yyyy-MM-dd for paid YouTube earnings.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :amount => String.t() | nil,
          :date => GoogleApi.AdSense.V2.Model.Date.t() | nil,
          :name => String.t() | nil
        }

  field(:amount)
  field(:date, as: GoogleApi.AdSense.V2.Model.Date)
  field(:name)
end

defimpl Poison.Decoder, for: GoogleApi.AdSense.V2.Model.Payment do
  def decode(value, options) do
    GoogleApi.AdSense.V2.Model.Payment.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AdSense.V2.Model.Payment do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
